#!/bin/sh

# This service will update the cache of the machine in one of two ways, either
# continuously, or upon startup of the daemon. It is recommended that you use
# the default setup to run this daemon.

/sbin/ldconfig

/usr/bin/fc-cache -f

for theme_dir in /usr/share/icons/* ; do
  if [ -r ${theme_dir}/icon-theme.cache ]; then
    /usr/bin/gtk-update-icon-cache -t -f ${theme_dir}
  fi
done

if [ -r /usr/share/icons/icon-theme.cache ]; then
  /usr/bin/gtk-update-icon-cache -t -f /usr/share/icons
  rm -f /usr/share/icons/icon-theme.cache
fi

/usr/bin/update-gtk-immodules

/usr/bin/update-gdk-pixbuf-loaders

/usr/bin/update-pango-querymodules

/usr/bin/update-mime-database /usr/share/mime

/usr/bin/update-desktop-database /usr/share/applications

/usr/bin/gdk-pixbuf-query-loaders --update-cache

/usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas

/usr/bin/pango-querymodules --update-cache

/usr/bin/gtk-query-immodules-2.0 --update-cache

/usr/bin/gtk-query-immodules-3.0 --update-cache

# The script will execute the update commands every hour. If you would like
# to adjust this interval, edit the number below to the appropriate seconds
# you would like to have the script re-execute. The default is set at 3600
# seconds = 1 hour or (60 sec x 60 minutes = 3600 seconds).

exec chpst -P /usr/bin/pause